// @ts-ignore
import { api } from '@/utils/api';

/** 删除登录日志数据 POST /loginLog/delete */
export async function loginLogDelete(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function loginLogDelete(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function loginLogDelete(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function loginLogDelete(body: BASE.ID, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/loginLog/delete`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/loginLog/delete`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取登录日志数据 POST /loginLog/get */
export async function loginLogGet(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultLoginLog>;

export async function loginLogGet(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultLoginLog>>;

export async function loginLogGet(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultLoginLog>;

export async function loginLogGet(body: BASE.ID, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultLoginLog>(`/app/loginLog/get`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultLoginLog>(`/app/loginLog/get`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 将登录的账号踢下线 POST /loginLog/kick */
export async function loginLogKick(
  body: BASE.KickUserDTO,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function loginLogKick(
  body: BASE.KickUserDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function loginLogKick(
  body: BASE.KickUserDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function loginLogKick(body: BASE.KickUserDTO, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/loginLog/kick`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/loginLog/kick`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取登录日志分页数据 POST /loginLog/page */
export async function loginLogPage(
  body: BASE.LoginLogQuery,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultIPageLoginLog>;

export async function loginLogPage(
  body: BASE.LoginLogQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultIPageLoginLog>>;

export async function loginLogPage(
  body: BASE.LoginLogQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultIPageLoginLog>;

export async function loginLogPage(
  body: BASE.LoginLogQuery,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultIPageLoginLog>(`/app/loginLog/page`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultIPageLoginLog>(`/app/loginLog/page`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}
